<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html style="height: 100%;width: 100%">
<head>
	<title></title>
    <%@include file="/WEB-INF/common/hplus-css.jsp"%>
    <%@include file="/WEB-INF/common/hplus-js.jsp" %>
    <style type="text/css">
    #required{
	color:red;
}
    </style>
</head>

<body class="gray-bg" style="height: 100%;width: 100%">
    <div class="wrapper wrapper-content animated fadeInRight" style="height: 100%;width: 100%">
        <div class="row" style="height: 100%;width: 100%">
            <div class="col-sm-12" style="height: 100%;width: 100%">
                <div class="ibox" style="height: 100%;width: 100%">
                    <div class="ibox-content" style="height: 100%;width: 100%">
                        <form action="${path}/order/close" class="form-horizontal m-t" id="userForm" method="post" enctype="multipart/form-data">
                            <input type="hidden" name="id" value="${id}" />
                            <div>
                               <div class="form-group">
                                   <label class="col-sm-3 control-label">是否不当行为：</label>
                                   <div class="col-sm-1">
                                       <input type="radio" value="0" checked onclick="show(1)" name="differentiate"/>否
                                       <input type="radio" value="1" name="differentiate" onclick="show(2)" />是
                                                                          </div>
                                   <label style="display:none;" id="s2" class="col-sm-1 control-label"><span style="color: red">*</span>扣除收益：</label>
                                   <div style="display:none;" id="s1" class="col-sm-5">
                                       <input class="form-control" style="text-align: center" type="number" name="rate" id="rate" placeholder="若有不当行为不指定减少收益比例   默认减少5%" />
                                   </div>
                               </div>

                               <div class="form-group" id="show" style="display: none">
                                   <label class="col-sm-3 control-label">不当行为说明：</label>
                                   <div class="col-sm-7">
                                       <input type="text" placeholder="若没不当行为,可不填(60字以内)" maxlength="60" class="form-control" name="explain" />
                                   </div>
                               </div>


                                <div class="form-group" id="1" >
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control"  aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                            <option value="${type0.id}">${type0.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type0.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required"  name="ids">
                                            <c:forEach items="${child0}" var="type">
                                                <option value="${type.id}">${type.name}</option>
                                            </c:forEach>

                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("1")'>删除</button>
                                    </div>
                                </div>


                                <div class="form-group" id="2"  >
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control"  aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                                <option value="${type1.id}">${type1.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type1.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required"  name="ids">
                                            <c:forEach items="${child1}" var="type">
                                                <option value="${type.id}">${type.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("2")'>删除</button>
                                    </div>
                                </div>

                                <div class="form-group"  id="3">
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control"  aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                                <option value="${type2.id}">${type2.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type2.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required" id="2" name="ids">
                                            <c:forEach items="${child2}" var="type">
                                                <option value="${type.id}">${type.name}</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("3")'>删除</button>
                                    </div>
                                </div>

                                <div class="form-group" id="4" >
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" id="1" aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                                    <option value="${type3.id}">${type3.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type3.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required"  name="ids">
                                            <c:forEach items="${child3}" var="type">
                                                <option value="${type.id}">${type.name}</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("4")'>删除</button>
                                    </div>
                                </div>

                                <div class="form-group" id="5" >
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" id="1" aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                                    <option value="${type4.id}">${type4.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type4.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required"  name="ids">
                                            <c:forEach items="${child4}" var="type">
                                                <option value="${type.id}">${type.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type.money}元</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("5")'>删除</button>
                                    </div>
                                </div>

                                <div class="form-group" id="6" >
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" id="1" aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                                    <option value="${type5.id}">${type5.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type5.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required"  name="ids">
                                            <c:forEach items="${child5}" var="type">
                                                <option value="${type.id}">${type.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type.money}元</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("6")'>删除</button>
                                    </div>
                                </div>

                                <div class="form-group"  id="7">
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control"  aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                                    <option value="${type6.id}">${type6.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type6.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required"  name="ids">
                                            <c:forEach items="${child6}" var="type">
                                                <option value="${type.id}">${type.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type.money}元</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("7")'>删除</button>
                                    </div>
                                </div>

                                <div class="form-group"  id="8">
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                                    <option value="${type7.id}">${type7.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type7.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required"  name="ids">
                                            <c:forEach items="${child7}" var="type">
                                                <option value="${type.id}">${type.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type.money}元</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("8")'>删除</button>
                                    </div>
                                </div>

                                <div class="form-group" id="9" >
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control"  aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                                    <option value="${type9.id}">${type9.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type9.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required"  name="ids">
                                            <c:forEach items="${child9}" var="type">
                                                <option value="${type.id}">${type.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type.money}元</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("9")'>删除</button>
                                    </div>
                                </div>

                                <div class="form-group"  id="10">
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control"  aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                                    <option value="${type10.id}">${type10.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type10.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required" id="2" name="ids">
                                            <c:forEach items="${child10}" var="type">
                                                <option value="${type.id}">${type.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type.money}元</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("10")'>删除</button>
                                    </div>
                                </div>

                                <div class="form-group" id="11"  >
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control"  aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                                    <option value="${type11.id}">${type11.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type11.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required" id="2" name="ids">
                                            <c:forEach items="${child11}" var="type">
                                                <option value="${type.id}">${type.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type.money}元</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("11")'>删除</button>
                                    </div>
                                </div>

                                <div class="form-group" id="12" >
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control"  aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                                    <option value="${type12.id}">${type12.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type12.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required"  name="ids">
                                            <c:forEach items="${child12}" var="type">
                                                <option value="${type.id}">${type.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type.money}元</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("12")'>删除</button>
                                    </div>
                                </div>

                                <div class="form-group" id="13" >
                                    <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" id="" aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                                    <option value="${type13.id}">${type13.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type13.money}元</option>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" aria-required="true" required="required"  name="ids">
                                            <c:forEach items="${child13}" var="type">
                                                <option value="${type.id}">${type.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type.money}元</option>
                                            </c:forEach>
                                        </select>
                                    </div>

                                    <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(kg)：</label>
                                    <div class="col-sm-1">
                                        <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                    </div>
                                    <div class="col-sm-1" style="margin-left: 30px">
                                        <button type="button" class="btn btn-default btn-xs" onclick='del("13")'>删除</button>
                                    </div>
                                </div>
                             <div id="14" >
                            <div class="form-group"  >
                                <label class="col-sm-2 control-label"><span >*</span>类型：</label>
                                <div class="col-sm-2">
                                    <select class="form-control"  aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                                            <option value="${type8.id}">${type8.name}</option>
                                    </select>
                                </div>

                                <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
                                <div class="col-sm-3">
                                    <select class="form-control" aria-required="true" required="required"  name="ids">
                                        <c:forEach items="${child8}" var="type">
                                            <option value="${type.id}">${type.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type.money}元</option>
                                        </c:forEach>
                                    </select>
                                </div>

                                <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(个)：</label>
                                <div class="col-sm-1">
                                    <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
                                </div>
                                <div class="col-sm-1" style="margin-left: 30px">
                                    <button type="button" class="btn btn-primary btn-xs" onclick="add()">增加</button>
                                    <button type="button" class="btn btn-danger btn-xs" onclick="drop(this)">删除</button>
                                </div>
                            </div>
                             </div>
                           </div>
                        </form>
                        <div class="form-group" style="text-align: center;margin-bottom: 0px;">
                            <div class="col-sm-4 col-sm-offset-3" style="text-align: center">
                                <button class="btn btn-primary" id="add-btn" type="button">确认</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<div style="display: none;">
    <div id="model" >
        <div class="form-group"  >
            <label class="col-sm-3 control-label"><span >*</span>类型：</label>
            <div class="col-sm-2">
                <select class="form-control"  aria-required="true" name="type" required="required" onchange="conlog(this.value,this)" >
                    <option value="${type8.id}">${type8.name}</option>
                </select>
            </div>

            <label class="col-sm-1 control-label"><span style="color: red">*</span>名称：</label>
            <div class="col-sm-2">
                <select class="form-control" aria-required="true" required="required"  name="ids">
                    <c:forEach items="${child8}" var="type">
                        <option value="${type.id}">${type.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type.money}元</option>
                    </c:forEach>
                </select>
            </div>

            <label class="col-sm-1 control-label"><span style="color: red">*</span>数量(个)：</label>
            <div class="col-sm-1">
                <input type="text" aria-required="true" required="required" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" maxlength="5" name="num" class="form-control" placeholder=""/>
            </div>
            <div class="col-sm-1" style="margin-left: 30px">
                <button type="button" class="btn btn-default btn-xs" onclick="drop(this)">删除</button>
            </div>
        </div>
    </div>
</div>



    <%@include file="/WEB-INF/common/hplus-suggest-js.jsp"%>
    <!--手机号 生分证，表单校验插件 -->
<script src="${pageContext.request.contextPath}/assets/js/validate/dist/additional-methods.js"></script>

    <script src="${path}/assets/hplus/js/demo/form-validate-demo.js"></script>
    <script>

            $("#add-btn").click(function() {
            	var valid = $("#userForm").valid();
                var flag1 =false;
                var flag2 =false;

                if ($("#rate").val()>100){
                    layer.msg("扣除收益不能超过100%!",{icon:5});
                    return;
                }

                $('form select').each(function (i){
                   var val = this.value;
                   console.log(val);

                   if (val==''){
                       flag1=true;
                       return false;
                   }

                });

                if (flag1==true){

                    layer.msg("有下拉选未填写!",{icon:5})
                    return;
                }


                    $('form  input[name="num"]').each(function (i){
                        var val = this.value;
                        console.log("输入框"+val);

                        if (val==''){
                            flag2=true;
                            return false;
                        }

                    });

                if (flag2==true){

                    layer.msg("有输入框未填写!",{icon:5})
                    return;
                }



                if(valid) {
            		$("#userForm").ajaxSubmit({
                        dataType: "json",
                        success: function (json) {
                            var code = json.code;
                            if(code == 0){
                            	layer.msg(json.msg, {icon: 1});
                                setTimeout(function(){
                                	window.parent.location.reload();
                                	parent.parent.layer.closeAll();
                                }, 3000);
                            }else{
                            	layer.msg(json.msg, {icon: 5,time:3000});
                            }
                        },
                        error:function(){
                        	layer.msg('处理发送错误! 请联系管理员', {icon: 5});
                        }
                    });
            	}else{
            		layer.msg("请填写完整信息！！！！", {
						icon : 5
					});
            	}
        });

            function add() {
               var html = $('#model').html();
                $("#userForm").append(html);

            }

            function del($this) {

                $("#"+$this).remove();
                // $($this).parent().parent().parent().parent().find("div[id='div']").remove();
            }


            function drop($this) {
                $($this).parent().parent().remove();
            }




            function conlog(val,$this) {
                console.log("下拉选选择的value="+val)
                $($this).parent().parent().find("select[id='2']").empty();
                $.ajax({
                    url:"${path}/regenerant/query",
                    data:{"type":val},
                    dataType:"json",
                    type:"POST",
                    success:function (json) {
                        for (var i = 0; i <json.length ; i++) {
                            var name = json[i].name;
                            var  option = "<option value='"+json[i].id+"' >'"+name+"'</option>";

                            $($this).parent().parent().find("select[id='2']").append(option);
                        }


                    }
                });
            }

            function show(val) {
                if (val==1){
                    $('#show').hide();
                    $('#s1').hide();
                    $('#s2').hide();

                }else {
                    $('#show').show();
                    $('#s1').show();
                    $('#s2').show();
                }
            }


    </script>

</body>
</html>
